package com.dameng.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dameng.system.entity.SystemDept;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SystemDeptMapper extends BaseMapper<SystemDept> {

    @ResultType(List.class)
    @Select("select dept_id " +
            "from system_dept " +
            "start with pid=#{deptId} " +
            "connect by prior dept_id = pid")
    List<String> childDeptByDeptId(String deptId);
}
